Lowkey Hugo

Lowkey Hugo

Adding to a Dict in Python – How to Add to a Dictionary

Filtering through a data set is one of the most basic operations a developer should know how to perform.

Filtering refers to the process of restricting the result set to contain only those elements that satisfy a specified condition. It is also known as selection.

To be practical, imagine trying to search and collect oranges from a basket of fruits. That is filtering.

In this article, we will see different ways to filter through a List class.

Before we start filtering the List collection, we will create a public class called Employee that holds the employee details.

The Employee class is like a blueprint that holds the details for each employee. It has private fields for the name, id, and department of each employee.

The Employee class also has getter and setter methods to be able to set and get the value of each of the private field.

Here is the code that demonstrates what I was just explaining above: